package com.qiyeji.real_estate.service;



import com.qiyeji.real_estate.entity.customer;
import com.qiyeji.real_estate.mapper.customerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

@Service
public class CustomerService {
    @Autowired
    customerMapper customerMapper;
    //获取全部客户信息
    public List<customer> getAllCustomer(){
        return customerMapper.getAllCustomer();
    }
    //通过项目编号获取客户信息 用于级联查询
    public customer getCustomerByProjectId(String pid){
        return customerMapper.getCustomerByProjectId(pid);
    }
    //增加客户信息
    public int insert(customer customer){
        return customerMapper.insert(customer);
    }
    //删除客户信息
    public int delete(String id){
        return customerMapper.deleteByPrimaryKey(id);
    }
    //修改客户信息
    public int update(customer customer){
        return customerMapper.updateByPrimaryKey(customer);
    }
    //通过客户id查询客户信息
    public customer selectById(String id){
        return customerMapper.selectByPrimaryKey(id);
    }
    //模糊查询
    public List<customer> fuzzyQuery(String key){
        return customerMapper.fuzzyQuery(key);
    }

    public CopyOnWriteArrayList<customer> getAllCustomerForExcel() { return customerMapper.getAllCustomerForExcel(); }

//    public customer getCustomerByProjectId(String pid){
//        return customerMapper.getCustomerByProjectId(pid);
//    }

    public customer getCustomerByProjectName(String pName){
        return customerMapper.getCustomerByProjectName(pName);
    }
}
